home *** CD-ROM | disk | FTP | other *** search
/ PD Collection CD 1 / PD Collection CD 1.iso / textual / tex / files / !tex / TeXsource / commontex / c / LOCAL < prev    next >
Encoding:
Text File  |  1988-04-26  |  831 b   |  45 lines

  1. /* Local.c - calls not in ISO library */
  2. #include <stdio.h>
  3. #define WRITE_ACCESS 2
  4. /* Tried to #include "file.h" but couldn't! */
  5.  
  6. void putw(int w, FILE *f) {
  7.   fputc(w & 255, f); w >>= 8;
  8.   fputc(w & 255, f); w >>= 8;
  9.   fputc(w & 255, f); w >>= 8;
  10.   fputc(w & 255, f);
  11. }
  12.  
  13. int getw(FILE *f) {
  14. int w;
  15.   w =     fgetc(f);
  16.   w = w | (fgetc(f)<<8);
  17.   w = w | (fgetc(f)<<16);
  18.   w = w | (fgetc(f)<<24);
  19.   return(w);
  20. }
  21.  
  22. /* ok = access(name_of_file, amode) == 0 ? TRUE : FALSE; */
  23. /* used in FILE.C */
  24.  
  25. int access(char *filename, int amode) {
  26.   int fd;
  27.   FILE *test;
  28.   if (amode == WRITE_ACCESS) return(0);
  29.   test = fopen(filename, "r");
  30.   if (test) {
  31.     fd=0;
  32.     fclose(test);
  33.   } else {
  34.     fd=1;
  35.   }
  36.   return(fd);
  37. }
  38.  
  39. void call_editor(char *f, int l) {
  40. extern void exit(int n);
  41. fprintf(stderr,"*edit %s -LINE %d\n", f, l);
  42. exit(0);
  43. }
  44.  
  45.